﻿using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MyCompany.WebCrawler.Domain;

namespace MyCompany.WebCrawler.Test.Domain.DownloaderTests.Given_WrongLinks
{
    [TestClass]
    public class When_CleanUp:Context
    {
        Downloader downloader;
        private string goodLink = "http://google.com";

        public override void Arrange()
        {
            downloader = new Downloader();
            downloader.Links.Add("javascipt");
            downloader.Links.Add("bla-bla-bla");
            downloader.Links.Add(goodLink);
        }

        public override void Act()
        {
            downloader.RemoveBadLinks();
        }

        [TestMethod]
        public void Then_OnlyOneLinksAreAlive()
        {
            downloader.Links.Count.Should().Be(1);
        }

        [TestMethod]
        public void Then_OnlyHtmlLinksAreAlive()
        {
            downloader.Links[0].Should().Contain(goodLink);
        }
    }
}
